//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "net\fn_runevent.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
private ["_sEventName","_aEventHandlers", "_aEventArguments"];
_sEventName = _this select 0;
// 1. We extract the list of Event Handlers
_aEventHandlers = GVAR(event_holder) getVariable (_sEventName);
// 2. We test if we actually got a list back or not.
TRACE_1(_sEventName, _this);

if (!isNil "_aEventHandlers") then {
	// We extract the Arguments list (if any)
	_aEventArguments = _this select 1;
	if (!isNil "_aEventArguments") then {
		// We call EACH Event Handler with the same arguments.
		// As you see it makes extending capabilities an easy thing
		{_aEventArguments call _x} forEach _aEventHandlers;
	} else {
		// Same as above but without arguments.
		{call _x} forEach _aEventHandlers;
	};
};